package com.lanmaoly.proxy1.client;

import com.lanmaoly.proxy1.handler.DynamicProxy;
import com.lanmaoly.proxy1.handler.MyInvocationHandler;
import com.lanmaoly.proxy1.sub.RealSubject;
import com.lanmaoly.proxy1.sub.Subject;

import java.lang.reflect.InvocationHandler;

public class ClientOne {

    public static void main(String[] args) {
        Subject subject = new RealSubject();
        InvocationHandler handler = new MyInvocationHandler(subject);
        Subject proxy = DynamicProxy.newProxyInstance(subject.getClass().getClassLoader(), subject.getClass().getInterfaces(), handler);
        proxy.doSomeThing("come on");
    }
}
